import {IsEmail, IsEnum, IsNotEmpty, IsPhoneNumber, IsString} from 'class-validator';

export class RegWebUserDto{
    @IsNotEmpty({ message:'邮箱地址不能为空' })
    email: string;

    @IsNotEmpty({ message:'用户名不能为空' })
    username: string;

    @IsNotEmpty({ message:'密码不能为空' })
    password: string;

    @IsNotEmpty({ message:'手机号不能为空' })
    @IsPhoneNumber('CN', { message: '请输入有效的中国手机号' })
    phone: string;
}

export class LoginWebUserDto {
    @IsString()
    account: string;

    @IsString()
    password: string;
}


export class SendValidCodeDto {
    @IsEnum(['1', '2'],{  message: 'type入参错误,1是手机，2是邮箱' })
    type: string;

    @IsNotEmpty({ message:'手机号或邮箱不能为空'})
    account: string;
}

export class validCodeDto extends  SendValidCodeDto{
    @IsNotEmpty({ message:'验证码不能为空'})
    code: string;
}


export class resetPwdDto {
    @IsNotEmpty({ message:'密钥不能为空'})
    token: string;

    @IsNotEmpty({ message:'密码不能为空'})
    password: string;
}
